<?php
/**
 * The template for displaying search results.
 *
 * @package Behold
 * @since Behold 1.0.0
 */
?>

<?php
	get_header();
	if ( have_posts() ) :
	?>
		<div class="b-search-results">			
			<h3 title="Click to clear the search results." onclick="document.location.href='<?php echo esc_url( home_url( '/' ) );?>';">
				<?php printf(__("Search results for: %s", "behold"), "<span>");
					the_search_query();
				?>
				</span>
			</h3>			
		</div>
	<?php
		behold_post_navigation( "nav-above" );
	endif;
?>

<div id="main" class="group">
	<div id="posts-container">
		<?php if ( have_posts() ) :
			while ( have_posts() ) :
					the_post();		
					if ( get_post_format() == "gallery" ):
						get_template_part( 'content', 'gallery' );
					elseif ( get_post_type() == "page" ):
							get_template_part( 'content', 'page' );
					else :
						get_template_part( 'content' );
					endif;				
			   endwhile;
		else : ?>
			<div class="search-results">
				<?php _e('Sorry. No posts contain the text <strong>"' . get_search_query() . '"</strong>. Please retry with different search term.','Behold'); ?>
			</div>
		<?php endif;?>		
	</div>	<!-- closing of posts-container> -->
	<?php 
	if ( have_posts() ) :
		behold_post_navigation( "nav-below" );
	endif;
	?>
</div><!-- closing of main -->

<?php
	get_sidebar('right');
	get_footer(); 
?>